// 用户状态
import $ajax from '../../config/http'
import router from '../../router'
const state = {
  token: null,
  userInfo: null,
  navList:null,

}
const mutations = {
  // 登录
  LOGIN: (state, data) => {
    localStorage.token = data;
    state.token = data;
  },

  // 保存用户信息
  SAVEUSERINFO: (state, data) => {
    localStorage.userInfo = JSON.stringify(data);
    state.userInfo = data;
  },

  // 登出
  LOGOUT: (state) => {
    localStorage.removeItem('token');
    localStorage.removeItem('userInfo');
    localStorage.removeItem('navList')

    state.token = null;
    state.userInfo = null;
    state.navList = null;
  },
  //保存用户权限信息
  NAVLIST:(state,data)=>{
    localStorage.navList = JSON.stringify(data);
    state.navList = data;
  },

}
const actions = {

}
export default {
  state,
  mutations,
  actions
}
